using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class transaction
    {
            public long id{get;set;}
            public long userid{get;set;}
            public string description{get;set;}
            public DateTime createdate{get;set;}
            public int type{get;set;}
            public bool active{get;set;}
         
        public transaction()
        {       
                    description ="";   
        }
        
       static transaction DynamicCast<T>(object row_data, object row_header) where T : transaction
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           transaction ret = new transaction();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "id":
                        ret.id = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "userid":
                        ret.userid = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "description":
                        ret.description = ConvertObject.ToString(dt[column]);
                       break;
                      case  "createdate":
                        ret.createdate = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "type":
                        ret.type = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "active":
                        ret.active = ConvertObject.ToBool(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
